# @Author   : 懒羊羊
# @File     : aaa.py
# @Time     : 2024/12/5 14:34
from selenium.webdriver.chrome import webdriver
from selenium.webdriver.common.by import By


class RegPage():
    unameE = (By.NAME, "username")
    uemailE = (By.NAME, "email")
    upwdE = (By.NAME, "password")
    upwdE2 = (By.NAME, "confirm_password")

    regE = (By.NAME, "Submit")

    def zhuce(self, a, b, c, d, e, f):
        zc = webdriver.WebDriver()
        # 通过实例打开网页
        zc.get("http://192.168.106.130/user.php?act=register")
        zc.implicitly_wait(10)

        # 输入注册用户信息
        # zc.find_element_by_name ("username").send_keys (a)
        # zc.find_element_by_name ("email").send_keys (b)
        # zc.find_element_by_name ("password").send_keys (c)
        # zc.find_element_by_name ("confirm_password").send_keys (c)
        # zc.find_element_by_name ("extend_field2").send_keys (d)
        # zc.find_element_by_name ("extend_field3").send_keys (e)
        # zc.find_element_by_name ("extend_field4").send_keys (e)
        # zc.find_element_by_name ("extend_field5").send_keys (e)
        # zc.find_element_by_xpath ('/html/body/div[3]/div[3]/div[1]/form/table/tbody/tr[10]/td[2]/'
        #                           'select/option[1]').click ()
        # zc.find_element_by_xpath ("/html/body/div[3]/div[3]/div[1]/form/table/tbody/tr[10]/td[2]/"
        #                           "select/option[5]").click ()
        # zc.find_element_by_name ("passwd_answer").send_keys (f)
        # zc.find_element_by_name ("Submit").click ()

        zc.find_element(*self.unameE).send_keys(a)
        zc.find_element(*self.uemailE).send_keys(b)
        zc.find_element(*self.upwdE).send_keys(c)
        zc.find_element(*self.upwdE2).send_keys(d)

        zc.find_element(*self.regE).click()


if __name__ == '__main__':
    rp = RegPage()

    rp.zhuce(a='wu1', b='2411617685@qq.com', c="123456", d="123", e="123456789", f="大话西游")